package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.UserData;
import com.cskaoyan.bean.param.BaseParam;
import com.cskaoyan.service.UserService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author stone
 * @date 2022/06/02 20:41
 */
@RestController
@RequestMapping("admin/user")
public class UserController {

    @Autowired
    UserService userService;

    // 使用注解将权限和请求url绑定起来
    @RequiresPermissions(value = {"admin:user:list","admin:user:user"},logical = Logical.OR)
    @RequestMapping("list")
    //public BaseRespVo list(Integer page,Integer limit,String sort,String order,String username) {
    public BaseRespVo list(BaseParam param, String username) {
        //UserData userData = userService.query(param, username);
        UserData userData = userService.query2(param, username);
        return BaseRespVo.ok(userData);
    }
}
